package com.basic.technology.study.introduction.thread.communication;

public class JoinTest {
    static int num = 0;

    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(() ->{
            System.out.println(System.currentTimeMillis() + ",start " + Thread.currentThread().getName());
            for (int i = 0; i < 10; i++) {
                num++;
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("----"+System.currentTimeMillis());
            }
            System.out.println(System.currentTimeMillis() + ",end " + Thread.currentThread().getName());
        });
        t1.start();
        t1.join();
        System.out.println(System.currentTimeMillis() + ",num = " + num);
    }
}
